
package cesdentalrecord.dao.view;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import cesdentalrecord.dao.controller.AddOralServicesController;
import cesdentalrecord.dao.Student;
import cesdentalrecord.dao.ToothPeer;

public class AddOralServicesView {

	/**
	 * @param args
	 */

    AddOralServicesController aosc = new AddOralServicesController();
    
    
    public void displayAcknowledgement(){
    	System.out.println("Oral health services rendered has been successfully added.");
    }
    
/*    public void setStudentID(int studentID){
    	this.studentID = studentID;
    }
    
    public void setDateOfService(String dateOfService){
    	this.dateOfService = dateOfService;
    }
    
    public void setService(String service){
    	this.service = service;
    }
    
    public String getService(){
    	return this.service;
    }
    
    public void setOralProphy(boolean oralProphy){
    	this.oralProphy = oralProphy;
    }
    public void setTempFilling(boolean tempFilling){
    	this.tempFilling = tempFilling;
    }
    public void setPermFilling(boolean permFilling){
    	this.permFilling = permFilling;
    }
    public void setSealant(boolean sealant){
    	this.sealant = sealant;
    }
    public void setExo(boolean exo){
    	this.exo = exo;
    }
    
    public void setFlouride(boolean flouride){
    	this.flouride = flouride;
    }
    public void setConsultation(boolean consultation){
    	this.consultation = consultation;
    }

    public void setOther(boolean other){
    	this.other = other;
    }
    public void setRemark(String remark){
    	this.remark = remark;
    }
    
  */  
	public int sendAddOralServicesRequest(int studentID, String dateOfService, 
			Boolean oralProphy,Boolean tempFilling,Boolean permFilling,Boolean sealant,
			Boolean exo,Boolean flouride,Boolean consultation,boolean other,String remark) throws IOException {
		// TODO Auto-generated method stub
		
		int oralServiceID = -1;
		/*
		int studentID;
	    String dateOfService;
	    String service;
	    boolean oralProphy;
	    boolean tempFilling;
	    boolean permFilling;
	    boolean sealant;
	    boolean exo;
	    boolean flouride;
	    boolean consultation;
	    boolean other;
	    String remark;
	    */
		Student s = new Student();

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		
		SearchView sv = new SearchView();
		
		AddOralServicesView aosv = new AddOralServicesView();
		
		int toothNumber;
		
		//s = sv.search();
		
		if(s != null){
		/*	studentID = s.getStudentID();
			
			System.out.println("Add Oral Services Rendered to " + s.getSurname()
					+ ", " + s.getFirstname() + " " + s.getMi());
			
			System.out.println("Enter date of exam:");
			dateOfService = input.readLine();
			

			System.out.println("Oral Prophy.? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) oralProphy=true;
			else oralProphy = false;
			
			System.out.println("Temp. Filling? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) tempFilling = true;
			else tempFilling = false;
			

			System.out.println("Perm. Filling? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) permFilling = true;
			else permFilling = false;
			
			System.out.println("Sealant? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) sealant = true;
			else sealant = false;
			
			System.out.println("Exo.? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) exo = true;
			else exo = false;
			
			System.out.println("Flouride? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) flouride = true;
			else flouride = false;
			
			System.out.println("Consultation? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) consultation = true;
			else consultation = false;
			
			System.out.println("Others? (y/n):");
			if(input.readLine().equalsIgnoreCase("y")) other= true;
			else other = false;		
			
			System.out.println("Enter remarks (if any): ");
			remark = input.readLine();
			
			
			
			if(oralServiceID != -1){
				System.out.println("--Tooth services update--");
				//tooth 5 (temporary)
				for(toothNumber = 55; toothNumber >= 51; toothNumber--) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
				ToothPeer.addToothService(oralServiceID, toothNumber, service);
				}
				//tooth 6 (temporary)
				for(toothNumber = 61; toothNumber <= 65; toothNumber++) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
					ToothPeer.addToothService(oralServiceID, toothNumber, service);
				}
				//tooth 1 (permanent)
				for(toothNumber = 18; toothNumber >= 11; toothNumber--) {
				
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
					ToothPeer.addToothService(oralServiceID, toothNumber, service);
				}
				//tooth 2 (permanent)
				for(toothNumber = 21; toothNumber <= 28; toothNumber++) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
					ToothPeer.addToothService(oralServiceID, toothNumber,service);
				}
				//tooth 4 (temporary)
				for(toothNumber = 48; toothNumber >= 41; toothNumber--) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
					ToothPeer.addToothService(oralServiceID, toothNumber, service);
				}
				//tooth 3 (temporary)
				for(toothNumber = 31; toothNumber <= 38; toothNumber++) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
					ToothPeer.addToothService(oralServiceID, toothNumber, service);
				}
				//tooth 8 (permanent)
				for(toothNumber = 85; toothNumber >= 81; toothNumber--) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
				ToothPeer.addToothService(oralServiceID, toothNumber,service);
				}
				//tooth 7 (permanent)
				for(toothNumber = 71; toothNumber <= 75; toothNumber++) {
					
					System.out.println("Enter tooth status for " + toothNumber + ":");
					service = input.readLine();
				
					ToothPeer.addToothService(oralServiceID, toothNumber,service);
				}*/
		oralServiceID = aosc.validateOralServicesEntries(studentID, dateOfService, 
    			oralProphy, tempFilling, permFilling, sealant,
    			exo, flouride, consultation, other, remark);
		
				//ToothPeer.addToothService(oralServiceID, toothNumber,service);
				aosv.displayAcknowledgement();
		//return oralServiceID;
				//} else System.out.println("Error.");
			
		}else System.out.println("Student not found.");
		
		return oralServiceID;
	}

}
